/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ill_be_bach.model;

import ill_be_bach.model.Key;
import java.io.Serializable;
import java.util.Locale;

/**
 *
 * @author Abhi
 */
public class Note implements Serializable {
    public int octave ;
    public Key key ;
    public Accidental accidental ;

    public Note(Key key, Accidental accidental, int octave) {
        this.key = key ;
        this.accidental = accidental ;
        this.octave = octave;
    }

    public Note(String key, int octave) {
        String keyUp = key.toUpperCase(Locale.ENGLISH).trim();
        if (key.equals("C")) {
            this.key = Key.C;
            this.accidental = Accidental.None ;
        }
        else if(key.equals("C#")) {
            this.key = Key.C;
            this.accidental = Accidental.Sharp;
        }
        else if (key.equals("D")) {
            this.key = Key.D;
            this.accidental = Accidental.None;
        }
        else if (key.equals("D#")) {
            this.key = Key.D;
            this.accidental = Accidental.Sharp;
        }
        else if (key.equals("Eb")) {
            this.key = Key.E;
            this.accidental = Accidental.Flat;
        }
        else if (key.equals("E")) {
            this.key = Key.E;
            this.accidental = Accidental.None;
        }
        else if (key.equals("F")) {
            this.key = Key.F;
            this.accidental = Accidental.None;
        }
        else if (key.equals("F#")) {
            this.key = Key.F;
            this.accidental = Accidental.Sharp;
        }
        else if (key.equals("G")) {
            this.key = Key.G ;
            this.accidental = Accidental.None;
        }
        else if (key.equals("G#")) {
            this.key = Key.G ;
            this.accidental = Accidental.Sharp;
        }
        else if (key.equals("A")) {
            this.key = Key.A;
            this.accidental = Accidental.None ;
        }
        else if (key.equals("A#")) {
            this.key = Key.A;
            this.accidental = Accidental.Sharp;
        }
        else if (key.equals("Bb")) {
            this.key = Key.B;
            this.accidental = Accidental.Flat;
        }
        else if (key.equals("B")) {
            this.key = Key.B;
            this.accidental = Accidental.None;
        }
        this.octave = octave ;
    }
}
